package
{
	import com.wskeee.ec.components.Button;
	import com.wskeee.ec.components.CheckBox;
	import com.wskeee.ec.components.HSeparate;
	import com.wskeee.ec.components.RadioButton;
	import com.wskeee.ec.components.TextAera;
	import com.wskeee.ec.components.VSeparate;
	import com.wskeee.ec.containers.CHBox;
	import com.wskeee.ec.containers.CVBox;
	import com.wskeee.ec.containers.HBox;
	import com.wskeee.ec.containers.LayoutConst;
	import com.wskeee.ec.containers.VBox;
	import com.wskeee.ec.core.EGlobal;
	import com.wskeee.ec.styles.Icons;
	
	import flash.display.BitmapData;
	import flash.display.Sprite;
	import flash.display.StageAlign;
	import flash.display.StageScaleMode;
	
	import examples.AlertExmaple;
	import examples.ButtonExample;
	import examples.ComboBoxExample;
	import examples.ContainerExample;
	import examples.IconExample;
	import examples.IdeSkinExample;
	import examples.ListExample;
	import examples.ScrollBarExample;
	import examples.TreeExample;
	
	public class ec extends Sprite
	{
		private var mainBox:VBox;
		private var rowBox:HBox;
		
		public function ec()
		{
			stage.align = StageAlign.TOP_LEFT;
			stage.scaleMode = StageScaleMode.NO_SCALE;
			
			EGlobal.initialize(stage);
			EGlobal.useIDESkin = true;
			
			mainBox = new VBox();
			mainBox.verticalGap = 20;
			mainBox.x = mainBox.y = 10;
			addChild(mainBox);
			
			var icon:Object = Icons.treeLeafIcon;
			var box:VBox = new VBox();
			box.height = 400;
			//box.width = 400;
			box.paddingTop = 10;
			box.paddingLeft = 10;
			box.paddingRight = 10;
			box.verticalAlign = LayoutConst.TOP;
			box.horizontalAlign = LayoutConst.RIGHT;
			
			var b:Button = new Button();
			b.width = 100;
			b.height = 100;
			b.icon = icon;
			box.addChild(b);
			var cb:CheckBox = new CheckBox();
			cb.labelPlacement = LayoutConst.RIGHT;
			box.addChild(cb);
			var rb:RadioButton = new RadioButton();
			rb.labelPlacement = LayoutConst.LEFT;
			box.addChild(rb);
			
			box.addChild(new Button());
			var vsp:VSeparate = new VSeparate();
			vsp.height = 10;
			vsp.width = 100;
			box.addChild(vsp);
			box.addChild(new Button());
			
			for(var i:int=0;i<5;i++)
			{
				b = new Button();
				b.width = Math.random()*100+20;
				b.height = Math.random()*50+20;
				box.addChild(b);
			}
			addChild(box);
			box.x = box.y = 20;
		}
		
		private function initComp():void
		{
			addRow();
			rowBox.addChild(IconExample.createIcons());
			rowBox.addChild(IdeSkinExample.createIDESkin());
			addRow();
			rowBox.addChild(ContainerExample.createVBox());
			rowBox.addChild(ContainerExample.createHBox());
			rowBox.addChild(ContainerExample.createGridbox());
			rowBox.addChild(ButtonExample.createButton());
			rowBox.addChild(ScrollBarExample.createScrollBar());
			rowBox.addChild(ListExample.createList());
			
			addRow();
			rowBox.addChild(TreeExample.createTree());
			rowBox.addChild(ComboBoxExample.createComboBox());
			rowBox.addChild(AlertExmaple.createAlert());
		}
		
		private function addRow():void
		{
			rowBox = new HBox();
			rowBox.verticalGap = rowBox.horizontalGap = 5;
			rowBox.border = true;
			rowBox.paddingTop = 5;
			rowBox.paddingBottom = 5;
			rowBox.paddingLeft = 5;
			rowBox.paddingRight = 5;
			mainBox.addChild(rowBox);
		}
	}
}